import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { IPSSysRef } from './ipssys-ref';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysRefImpl extends PSModelObjectImpl implements IPSSysRef {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  get refParam(): string {
    return this.M.refParam;
  }

  get refParam2(): string {
    return this.M.refParam2;
  }

  get refParams(): IModel {
    return this.M.refParams;
  }

  get refServiceId(): string {
    return this.M.refServiceId;
  }

  get sysCodeName(): string {
    return this.M.sysCodeName;
  }

  get sysName(): string {
    return this.M.sysName;
  }

  get sysPkgName(): string {
    return this.M.sysPkgName;
  }

  get sysRefTag(): string {
    return this.M.sysRefTag;
  }

  get sysRefType(): 'SUBSYS' | 'DEVSYS' | 'DEVSYSCLOUD' | 'CLOUDHUBSUBAPP' | 'ETLEXTRACT' | 'ETLTRANSFORM' | 'ETLLOAD' | 'ETLSOURCE' | 'ETLMODEL' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.sysRefType;
  }

  get sysSrvCodeName(): string {
    return this.M.sysSrvCodeName;
  }

  get sysVCName(): string {
    return this.M.sysVCName;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysRefImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'system.IPSSysRef') return true;
    return super.instanceof(cls);
  }
}
